<template>
  <div>
    <!-- <router-view /> -->
    <van-tabbar active-color="#ee0a24" v-model="active">
      <van-tabbar-item replace icon="service-o">发现</van-tabbar-item>
      <van-tabbar-item replace icon="user-circle-o">我的</van-tabbar-item>
      <van-tabbar-item replace icon="cashier-o">离线</van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
export default {
  data() {
    return {
      active: 0,
      router:"",
    };
  },
  watch: {
    active(v) {
      if (v == 0) {
        this.$router.push({ name: "listen" });
      }
      if (v == 1) {
        this.$router.push({ name: "mine" });
      }
         if(v==2){
        this.$router.push({name:"online"})
      }
    },
    router(v){
      if(v=="mine"){
        this.active=1
      }
      if(v=="index"){
        this.active=0
      } 
      if(v=="online"){
        this.active=2
      }
    }
  },
  mounted(){
    this.router=this.$route.name
  }
};
</script>